/*
 * Copyright 2003-2007 (c) Live Media Pty Ltd. <argot@einet.com.au> 
 *
 * This software is licensed under the Argot Public License 
 * which may be found in the file LICENSE distributed 
 * with this software.
 *
 * More information about this license can be found at
 * http://www.einet.com.au/License
 * 
 * The Developer of this software is Live Media Pty Ltd,
 * PO Box 4591, Melbourne 3001, Australia.  The license is subject 
 * to the law of Victoria, Australia, and subject to exclusive 
 * jurisdiction of the Victorian courts.
 */

package com.colony.channel;

import java.io.IOException;

import com.argot.TypeException;
import com.argot.TypeOutputStream;
import com.argot.TypeWriter;
import com.argot.common.BigEndianUnsignedInteger;

public class ChannelIdentifier
{
	public static final String TYPENAME = "channel.id";

	private int _id;
	
	public ChannelIdentifier( long id )
	{
		_id = (int) id;
	}
	
	public int getId()
	{
		return _id;
	}
		
	public static class ChannelIdentifierTypeWriter
	implements TypeWriter
	{
		public void write(TypeOutputStream out, Object o)
		throws TypeException, IOException
		{
			ChannelIdentifier cid = (ChannelIdentifier) o;
			
			out.writeObject( out.getTypeMap().getId( BigEndianUnsignedInteger.TYPENAME ), new Integer( cid._id ));
		}
	}

}
